<template>
    <section class="yw_info_desc">
  
        	<el-form-item label="业务类型(可多选)" 
                :rules="[
                  { required: true, message: '请选择业务类型', trigger: 'blur' },
                ]"
            >
				 <el-checkbox-group v-model="ywInfoDescForm.businessType" >
				     <el-checkbox-button class="box_checkbox" v-for="(item,index) in yewuType" :label="item.id" :key="index">{{item.name}}</el-checkbox-button>
				</el-checkbox-group>
			</el-form-item>
			  
			<el-form-item label="信息类型(可多选)" 
                :rules="[
                  { required: true, message: '请选择信息类型', trigger: 'blur' },
                ]"
            >
				 <el-checkbox-group v-model="ywInfoDescForm.infoType">
				     <el-checkbox-button class="box_checkbox" v-for="(item,index) in infoType" :label="item.id" :key="index">{{item.name}}</el-checkbox-button>
				</el-checkbox-group>
			</el-form-item>
			  
			<el-form-item label="描述" placeholder="100字以内">
				<el-input type="textarea" v-model="ywInfoDescForm.describe" ></el-input>
			</el-form-item>
    </section>
</template>

<script>
    export default {
    	props:{
    		yewuType:Array,
    		infoType:Array,
    		timeSubmit :Boolean,
    		hasDataYwInfoDesc:{
    			type:Object,
    			default: function () {
			   	 	return {}
			  	}
    		},
    	},
        data() {
          return {
          		ywInfoDescForm:{
          			businessType:[],
          			infoType:[],
          			describe:'',
          		}
          };
        },
		mounted(){
			if(Object.keys(this.hasDataYwInfoDesc).length!=0){
				this.ywInfoDescForm.businessType=this.hasDataYwInfoDesc.businessType
				this.ywInfoDescForm.infoType=this.hasDataYwInfoDesc.infoType
				this.ywInfoDescForm.describe=this.hasDataYwInfoDesc.describe
			}
		},
        watch:{
        	timeSubmit(newVal){
        		this.$emit("outPutForm",this.ywInfoDescForm);
        	},
        	hasDataYwInfoDesc:{
        		handler(newVal, oldVal){
//      			alert("dwad");
        			this.ywInfoDescForm.businessType=newVal.businessType.map((item)=>{
        				return Number(item);
        			})
					this.ywInfoDescForm.infoType=newVal.infoType.map((item)=>{
        				return Number(item);
        			})
					this.ywInfoDescForm.describe=newVal.describe
        		},
        		deep:true
        	},
        	
        }
  };
</script>

<style scoped="scoped">
    
</style>